/**
 * 
 */
package com.pocketsweet.model;

import java.util.Date;
import java.util.List;

import com.avos.avoscloud.AVClassName;
import com.avos.avoscloud.AVFile;
import com.avos.avoscloud.AVUser;
import com.pocketsweet.ui.uilib.SlideView;
import com.pocketsweet.utils.ToolKits;

/**
 * @author hantian
 * 
 */
@AVClassName("_User")
public class MLUser extends AVUser {
	// //////////////////////////////////////////
	// 常量
	// //////////////////////////////////////////
	public static String NICKNAME = "nickname";// 用户的昵称
	public static String AVATAR = "avatar";// 头像URL
	public static String BIRTHDAY = "birthday";// BIRTHDAY
	public static String GENDER = "gender";// 性别
	public static String LEVEL = "level";// 用户的等级
	public static String STATUS = "status";// 用户的状态值
	public static String HEIGHT = "height";// 身高
	public static String WEIGHT = "weight";// 体重
	public static String MOOd = "figure";// 外形
	public static String BALANCE = "balance";// 钱包
	public static String EMOTION = "emotion";// 情感状态
	public static String DISLIKE = "dislike";// 不喜欢的东西
	public static String LANGUAGE = "language";// 会的语言
	public static String JOB = "job"; // 职业
	public static String BELONG = "belong";// 属于的类型
	public static String LIKES = "likes";// 喜欢的类型
	public static String LIKE = "like";// 喜欢的类型
	public static String LIKE_TAGS = "like_tags";// 喜欢的
	public static String DISLIKE_TAGS = "dislike_tags";// 不喜欢的
	public static String SPECIAL = "special";// 不喜欢的
	public static String CALL_TAGS = "call_tags";// 我想叫你的标签
	public static String CALLED_TAGS = "called_tags";// 我想你叫我的标签
	public static String WILLING_TAGS = "willing_tags";// 我想你叫我的标签
	public static String INTRO = "intro";// 用户介绍
	public static String CONSTELLATION = "constellation"; // 星座
	public static String LOCATION_CITY = "location_city";// 市
	public static String LOCATION_PROVINCE = "location_province";// 省
	public static String LOCATION_DISTRICT = "location_district";// 区
	public static String TYPE = "type";// 0-普通用户 1-推荐用户
	public static String PRICE = "price";// 用户的服务价格
	public static String QQ_ACCOUNT = "qq_account";
	public static String ALIPAY_ACCOUNT = "alipay_account";
	public static String LASTLOGIN = "lastLogin";// 用户最后登录时间
	public static String BACKGROUND = "background";// 用户最后登录时间
	public static String MOLIANID = "molianId";// 口袋恋人ID
	public static String ISUSERINITED = "isUserInited";// 是否完善资料
	public static String ISHASVOICE = "isHasVoice";// 是否有声线
	public static String LIKECOUNT = "likeCount";// 被喜欢的次数
	public static String BELONGTOARTICLE = "belongToArticle";// 属于哪篇文章
	public static String REPORT_COUNT = "reportCount";// 举报次数
	public static String SUBAVATAR = "subAvatar";
	public static String GOLD = "gold";// 时光数
	public static String MOBILE_PHONE_VERIFIED = "mobilePhoneVerified";// 时光数
	public static String NOTIFY_PHONE_NUM = "notifyPhoneNum";// 接收短信的手机号码
	public static String SIGN_COUNT = "signCount";// 晚睡打卡的次数



	// 聊天相关
	private int unreadMsgCount;// 未读消息数
	private String header;// 用于排序的头部
	public SlideView slide;// 用于主页滑动

	public MLUser() {
		// super.alwaysUseSubUserClass(MLUser.class);
	}

	public String getNotifyPhone() {
		return super.getString(NOTIFY_PHONE_NUM);
	}

	public void setNotifyPhone(String value) {
		super.put(NOTIFY_PHONE_NUM, value);
	}

	public int getGold() {
		return super.getInt(GOLD);
	}

	public void setGold(int value) {
		super.put(GOLD, value);
	}

	public String getSubAvatar() {
		return super.getString(SUBAVATAR);
	}

	public void setSubAvatar(String value) {
		super.put(SUBAVATAR, value);
	}

	// user所属文章（外键1:1）
	public MLArticle getArticle() {
		return (MLArticle) super.getAVObject(BELONGTOARTICLE);
	}

	public void setArticle(MLArticle value) {
		super.put(BELONGTOARTICLE, value);
	}

	public String getHeader() {
		return header;
	}

	public void setHeader(String header) {
		this.header = header;
	}

	public int getUnreadMsgCount() {
		return unreadMsgCount;
	}

	public int getIsInited() {
		return super.getInt(ISUSERINITED);
	}

	public void setIsInited(int value) {
		super.put(ISUSERINITED, value);
	}

	public boolean getIsHasVoice() {
		return super.getBoolean(ISHASVOICE);
	}

	public void setIsHasVoice(boolean value) {
		super.put(ISHASVOICE, value);
	}

	public boolean getIsMobileVerified() {
		return super.getBoolean(MOBILE_PHONE_VERIFIED);
	}

	public void setIsMobileVerified(boolean value) {
		super.put(MOBILE_PHONE_VERIFIED, value);
	}

	public void setUnreadMsgCount(int unreadMsgCount) {
		this.unreadMsgCount = unreadMsgCount;
	}

	// 昵称
	public String getNickname() {
		return ToolKits.replaceBlank(super.getString(NICKNAME));
	}

	public void setNickname(String value) {
		super.put(NICKNAME, value);
	}

	// 头像
	public AVFile getAvatar() {
		return super.getAVFile(AVATAR);
	}

	public void setAvatar(AVFile value) {
		super.put(AVATAR, value);
	}

	// 背景
	public AVFile getBackground() {
		return super.getAVFile(BACKGROUND);
	}

	public void setBackground(AVFile value) {
		super.put(BACKGROUND, value);
	}

	public String getBackgroundbaUrl() {
		AVFile background = getBackground();
		if (background != null) {
			return background.getUrl();
		} else {
			return null;
		}

	}

	public String getAvatarUrl() {
		AVFile avatar = getAvatar();
		if (avatar != null) {
			return avatar.getUrl();
		} else {
			return null;
		}
	}

	// 生日
	// public String getBirthdayFromat() {
	// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
	// return format.format(getBirthday());
	// }

	public Date getBirthday() {
		if (super.getDate(BIRTHDAY) != null) {
			return super.getDate(BIRTHDAY);
		} else {
			return null;
		}
	}

	public void setBirthday(Date value) {
		super.put(BIRTHDAY, value);
	}

	public int getAgeNum() {
		if (getBirthday() != null) {
			return ToolKits.countAge(getBirthday());
		} else {
			return 0;
		}

	}

	// 性别
	public int getGender() {
		return super.getInt(GENDER);
	}

	public void setGender(int value) {
		super.put(GENDER, value);
	}

	// 等级
	public int getLevel() {
		return super.getInt(LEVEL);
	}

	public void setLevel(int value) {
		super.put(LEVEL, value);
	}

	// 用户状态
	public int getStatus() {
		return super.getInt(STATUS);
	}

	public void setStatus(int value) {
		super.put(STATUS, value);
	}

	// 身高
	public int getHeight() {
		return super.getInt(HEIGHT);
	}

	public void setHeight(int value) {
		super.put(HEIGHT, value);
	}

	// 体重
	public int getWeight() {
		return super.getInt(WEIGHT);
	}

	public void setWeight(int value) {
		super.put(WEIGHT, value);
	}

	// 外形
	public String getFigure() {
		return super.getString(MOOd);
	}

	public void setFigure(String value) {
		super.put(MOOd, value);
	}

	// 举报次数
	public int getReportCount() {
		return super.getInt(REPORT_COUNT);
	}

	public void setReportCount(int value) {
		super.put(REPORT_COUNT, value);
	}

	// 钱包里的钱
	public double getBalance() {
		return super.getDouble(BALANCE);
	}

	public void setBalance(double value) {
		super.put(BALANCE, value);
	}

	// 情感状况
	public String getEmotion() {
		return super.getString(EMOTION);
	}

	public void setEmotion(String value) {
		super.put(EMOTION, value);
	}

	// 情感状况
	public String getLike() {
		return super.getString(LIKE);
	}

	public void setLike(String value) {
		super.put(LIKE, value);
	}

	// // 喜欢的东西
	// @SuppressWarnings("unchecked")
	// public List<String> getLike() {
	// return (List<String>) getList(LIKE);
	// }
	//
	// public void setLike(List<String> value) {
	// addAllUnique(LIKE, value);
	// }

	// 不喜欢的东西
	@SuppressWarnings("unchecked")
	public List<String> getDislike() {
		return (List<String>) getList(DISLIKE_TAGS);
	}

	public void setDislike(List<String> value) {
		addAllUnique(DISLIKE_TAGS, value);
	}

	public void removeDisLike(List<String> value) {
		removeAll(DISLIKE_TAGS, value);
	}

	// 特技
	@SuppressWarnings("unchecked")
	public List<String> getSpecial() {
		return (List<String>) getList(SPECIAL);
	}

	public void setSpecial(List<String> value) {
		addAllUnique(SPECIAL, value);
	}

	public void removeSpecial(List<String> value) {
		removeAll(SPECIAL, value);
	}

	@SuppressWarnings("unchecked")
	public List<String> getWillingTags() {
		return (List<String>) getList(WILLING_TAGS);
	}

	public void setWillingTags(List<String> value) {
		addAllUnique(WILLING_TAGS, value);
	}

	public void removeWillingTags(List<String> value) {
		removeAll(WILLING_TAGS, value);
	}

	// 会的语言
	@SuppressWarnings("unchecked")
	public List<String> getLanguage() {
		return (List<String>) getList(LANGUAGE);
	}

	public void setLanguage(List<String> value) {
		addAllUnique(LANGUAGE, value);
	}

	public void removeLanguage(List<String> value) {
		removeAll(LANGUAGE, value);
	}

	// 工作
	public String getJob() {
		return ToolKits.replaceBlank(super.getString(JOB));
	}

	public void setJob(String value) {
		super.put(JOB, value);
	}

	// 口袋恋人IDs
	public int getMolianId() {
		return super.getInt(MOLIANID);
	}

	public void setMolianId(int value) {
		super.put(MOLIANID, value);
	}

	// 属于的类型
	public String getBelong() {
		return super.getString(BELONG);
	}

	public void setBelong(String value) {
		super.put(BELONG, value);

	}

	// 喜欢的类型
	@SuppressWarnings("unchecked")
	public List<String> getLikeTags() {
		return (List<String>) getList(LIKE_TAGS);
	}

	public void setLikeTags(List<String> value) {
		addAllUnique(LIKE_TAGS, value);
	}

	public void removeLikeTags(List<String> value) {
		removeAll(LIKE_TAGS, value);
	}

	// 我想叫你的类型
	@SuppressWarnings("unchecked")
	public List<String> getCallTags() {
		return (List<String>) getList(CALL_TAGS);
	}

	public void setCallTags(List<String> value) {
		addAllUnique(CALL_TAGS, value);
	}

	public void removeCallTags(List<String> value) {
		removeAll(CALL_TAGS, value);
	}

	// 我想你叫我的标签
	@SuppressWarnings("unchecked")
	public List<String> getCalledTags() {
		return (List<String>) getList(CALLED_TAGS);
	}

	public void setCalledTags(List<String> value) {
		addAllUnique(CALLED_TAGS, value);
	}

	public void removeCalledTags(List<String> value) {
		removeAll(CALLED_TAGS, value);
	}

	// 签名
	public String getIntro() {
		return super.getString(INTRO);
	}

	public void setIntro(String value) {
		super.put(INTRO, value);
	}

	// 星座
	public String getConstellation() {
		if (getBirthday() != null) {
			return ToolKits.constellation(getBirthday());
		} else {
			return null;
		}

	}

	public void setConstellation(int value) {
		super.put(CONSTELLATION, value);
	}

	// 省市縣
	public String getLocationCity() {
		if (super.getString(LOCATION_CITY) != null) {
			return super.getString(LOCATION_CITY);
		} else {
			return "";
		}
	}

	public void setLocationCity(String location) {
		super.put(LOCATION_CITY, location);
	}

	public String getLocationProvince() {
		if (super.getString(LOCATION_PROVINCE) != null) {
			return super.getString(LOCATION_PROVINCE);
		} else {
			return "";
		}
	}

	public void setLocationProvince(String location) {
		super.put(LOCATION_PROVINCE, location);
	}

	public String getLocationDistrict() {
		if (super.getString(LOCATION_DISTRICT) != null) {
			return super.getString(LOCATION_DISTRICT);
		} else {
			return "";
		}
	}

	public void setLocationDistrict(String location) {
		super.put(LOCATION_DISTRICT, location);
	}

	public String getLocation() {
		return getLocationProvince() + getLocationCity()
				+ getLocationDistrict();
	}

	// 用户类型
	public int getType() {
		return super.getInt(TYPE);
	}

	public void setType(int value) {
		super.put(TYPE, value);
	}

	// 用户设置的价格
	public void setPrice(double value) {
		super.put(PRICE, value);
	}

	public double getPrice() {
		return super.getDouble(PRICE);
	}

	// 用户qq
	public String getQqAccount() {
		return super.getString(QQ_ACCOUNT);
	}

	public void setQqAccount(String value) {
		super.put(QQ_ACCOUNT, value);
	}

	// 阿里账号
	public String getAlipayAccount() {
		return super.getString(ALIPAY_ACCOUNT);
	}

	public void setAlipayAccount(String value) {
		super.put(ALIPAY_ACCOUNT, value);
	}

	// 用户最后登陆时间
	public Date getLastLoginTime() {
		return super.getDate(LASTLOGIN);
	}

	public void setLastLoginTime(Date value) {
		super.put(LASTLOGIN, value);
	}

	// 用户被赞的次数
	public int getLikeCount() {
		return super.getInt(LIKECOUNT);
	}

	public void setLikeCount(int value) {
		super.put(LIKECOUNT, value);
	}

	public int getSignCount() {
		return super.getInt(SIGN_COUNT);
	}

	public void setSignCount(int value) {
		super.put(SIGN_COUNT, value);
	}

}
